<?php
namespace Console;
use Swiftx\DataType\Verify;
use Swiftx\Http\Session;

/**
+---------------------------------------------------------------------------------------------------------------
 * 公告控制台控制器类
+---------------------------------------------------------------------------------------------------------------
 * @author		胡永强  <odaytudio@gmailcom>
 * @since		2015-02-25
 * @copyright	Copyright (c) 2014-2015 Swiftx Inc.
+---------------------------------------------------------------------------------------------------------------
 */
class Common {


    /**
     * 生成并显示图片验证码
     */
    public static function ImageVerify(){
        $verify = new Verify();
        Session::Set('Verify.Image', $verify->Code);
        $verify->ShowImage();
    }

    /**
     * 校验图片验证码正确
     * @param $code
     * @return bool
     */
    public static function CheckVerify($code){
        return strtolower($code)!=strtolower(Session::Value('Verify.Image'));
    }

    /**
     * 执行退出登陆操作
     */
    public static function ActionLogout(){
        session_destroy();
    }

}